gusucode.com > 黑白棋 V1.0 试用网络版源代码C++源码程序 > 黑白棋 V1.0 试用网络版源代码/BWChess/03D407_庞长才_PROJECT作业/BWChess钻石版/ip1.cpp
#include "stdafx.h" #include "BWChess.h" #include "ip1.h" #include "HelperAPI.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CIP dialog Cip::Cip(CWnd* pParent /*=NULL*/) : CDialog(Cip::IDD, pParent) { //{{AFX_DATA_INIT(CIP) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT m_DyShow=0; } void Cip::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CIP) // NOTE: the ClassWizard will add DDX and DDV calls here DDX_Control(pDX, IDC_IP, IP); DDX_Control(pDX, IDCANCEL, m_Cancel); DDX_Control(pDX, IDOK, m_OK); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(Cip, CDialog) //{{AFX_MSG_MAP(CIP) // NOTE: the ClassWizard will add message map macros here ON_WM_PAINT() //}}AFX_MSG_MAP END_MESSAGE_MAP() BOOL Cip::OnInitDialog() { CDialog::OnInitDialog(); IP.SetAddress( 166, 111, 195, 142 ); HICON hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); SetIcon(hIcon, TRUE); // Set big icon SetIcon(hIcon, FALSE); // Set small icon CenterWindow(); m_OK.SetIcon ( IDI_OPEN ); m_OK.AddToolTip ( _T("确定") ); m_OK.SetBtnCursor(IDC_HAND); m_OK.SetActiveFgColor(RGB(0,0,255)); m_Cancel.SetIcon ( IDI_CANCEL ); m_Cancel.AddToolTip ( _T("取消") ); m_Cancel.SetBtnCursor(IDC_HAND); m_Cancel.SetActiveFgColor(RGB(0,0,255)); UpdateData(FALSE); return TRUE; } void Cip::OnPaint() { CPaintDC dc(this); if(!m_DyShow) { m_DyShow++; DynamicShow(this,1); } } void Cip::OnCancel() { DynamicShow(this,0); CDialog::OnCancel(); } void Cip::OnOK() { UpdateData(); if(IP.IsBlank( )) { AfxMessageBox("请输入一个正确的IP地址!"); return; } else IP.GetAddress(IP1,IP2,IP3,IP4); DynamicShow(this,0); CDialog::OnOK(); }